
export class HttpHelper {
    static async send<T>(url: string, data?: any, method?: "get" | "post" | "head", responseType?: string, headers?: string[]): Promise<T> {
        return new Promise((resolve, reject) => {
            let req = new Laya.HttpRequest();
            req.on(Laya.Event.COMPLETE, (_data: T) => {
                resolve(_data);
            });
            req.on(Laya.Event.ERROR, (_data: any) => {
                console.log(_data);
            });
            req.send(url, data, method, responseType, headers);
        });
    }
}